package org.testmyapp.entities;

import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.IdClass;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;

import org.testmyapp.persistence.BusinessObjectMarker;

@Entity
@IdClass(CoveragePk.class)
public class Coverage implements BusinessObjectMarker {

	/**
	 * 
	 */
	private static final long serialVersionUID = 2630316419484531879L;

	public static String tableName = "Coverage";

	@Id
	@ManyToOne
	@JoinColumn(name = "tarif_def_fk")
	private TarifDefinition tarifDefinition;
	@Id
	@ManyToOne
	@JoinColumn(name = "claim_type_fk")
	private ClaimType claimType;
	private double maximumRate;
	private int percentage;
	private int retention;

	public int getPercentage() {
		return percentage;
	}

	public void setPercentage(int percentage) {
		this.percentage = percentage;
	}

	public TarifDefinition getTarifDefinition() {
		return tarifDefinition;
	}

	public void setTarifDefinition(TarifDefinition tarifDefinition) {
		this.tarifDefinition = tarifDefinition;
	}

	public ClaimType getClaimType() {
		return claimType;
	}

	public void setClaimType(ClaimType claimType) {
		this.claimType = claimType;
	}

	public double getMaximumRate() {
		return maximumRate;
	}

	public void setMaximumRate(double maximumRate) {
		this.maximumRate = maximumRate;
	}

	public int getRetention() {
		return retention;
	}

	public void setRetention(int retention) {
		this.retention = retention;
	}

	public String toString() {
		String result = "";
		result += "Covers: " + claimType + " (max: " + maximumRate
				+ ", retention: " + retention + ")";
		return result;
	}

}
